<!DOCTYPE html>
<html lang="ZH">
<head>
    <meta charset="UTF-8">
    <title>后台首页</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
    <script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap-theme.css" rel="stylesheet">
    <script type="text/javascript">
        // 预约处理菜单按钮
        $(document).ready(function () {
            $("#order-menu").click(function () {
                console.log('order');
                $("div.menu-page").css('display','none');
                $("#order-page").css('display','block');
                $.ajax({
                    url: '/admin.php/Order/getAllOrder',
                    method: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.code == 200) {
                            $("#order-page").empty();
                            $("#order-page").append(res.data);
                        } else if(res.code == 100) {
                            alert("未搜索到结果，请更改条件重试 !");
                        } else {
                            alert("查询失败，请稍后重试 !");
                        }
                    }
                });
            });
        });
        // 套餐管理菜单按钮
        $(document).ready(function () {
            $("#good-menu").click(function () {
                console.log('good');
                $("div.menu-page").css('display','none');
                $("#good-page").css('display','block');
            });
            $.ajax({
                url: 'admin.php/Good/getAllGood',
                dataType:'json',
                method:'get',
                success: function (res) {
                    if (res.code == 200) {
                        $("#good_table").empty();
                        $("#good_table").append(res.data);
                    }
                }
            });
        });
        // 用户管理菜单按钮
        $(document).ready(function () {
            $("#account-menu").click(function () {
                console.log('account');
                $("div.menu-page").css('display','none');
                $("#account-page").css('display','block');
            });
        });
        // 首页设置菜单按钮
        $(document).ready(function () {
            $("#banner-menu").click(function () {
                console.log('banner');
                $("div.menu-page").css('display','none');
                $("#banner-page").css('display','block');
            });
        });
        //查询预约订单
        $(document).ready(function () {
            $("#order-search").click(function () {
                console.log('search');
                var data = $("#order-form").serialize();
                console.log(typeof data,data);
                $.ajax({
                    url: "/admin.php/Order/searchOrder",
                    data: data,
                    method: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.code == 200) {
                            $("#order_table").empty();
                            $("#order_table").append(res.data);
                        } else if(res.code == 100) {
                            alert("未搜索到结果，请更改条件重试 !");
                        } else {
                            alert("查询失败，请稍后重试 !");
                        }
                    }
                });
            });
        });
    </script>
</head>
<body>
</body>
</html>